#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
char s[2020][10];
int fa[2020];
struct node 
{
	int x;
	int y;
	int d;
}p[20000000];
bool cmp(node a,node b)
{
	return a.d<b.d;
}
int find(int x)
{
	int r=x;
	while(r!=fa[r])
	{
		r=fa[r];
	}
	int i,j;
	i=x;
	while(i!=r)
	{
		j=fa[i];
		fa[i]=r;
		i=j;
	}
	return r;
}
int join(int x,int y)
{
	x = find(x);
	y = find(y);
	if(x==y) return 0;
	else 
	{
		fa[y] = x;
		return 1;
	}
}
int main()
{
	int n,cnt,t;
	while(scanf("%d",&n)&&n)
	{
		for(int i = 1;i<=n;i++) fa[i] = i;
		t = 0;
		for(int i = 1;i<=n;i++) scanf("%s",s[i]);
		for(int i = 1;i<=n;i++)
		{
			for(int j = i+1;j<=n;j++)
			{
				cnt = 0;
				for(int f = 0;f<7;f++)
				{
					if(s[i][f]!=s[j][f]) cnt++;
				}
				t++;
				p[t].x = i;
				p[t].y = j;
				p[t].d = cnt;
			}
		}
		sort(p+1,p+t+1,cmp);
		int ans = 0;
		for(int i = 1;i<=t;i++)
		{
			if(join(p[i].x,p[i].y))
			{
				ans += p[i].d;
			}
		}
		printf("The highest possible quality is 1/%d.\n",ans);
	}
}
